package com.xsjiong.je;

public class Battery extends EObject {
	@Override
	public double getResistance() {
		return 0;
	}

	public double Potential;

	public Battery(double p) {
		this.Potential = p;
	}

	public static Battery CreateDryCell() {
		return new Battery(1.5);
	}

	public static Battery CreateTheMains() {
		return new Battery(220);
	}

	public final EInterface Positive = new EInterface(this), Negative = new EInterface(this);

	public void Simulate() {
		EInfo info = new EInfo();
		info.Q.add(this.Positive);
		EInterface cur;
		while (!info.Q.isEmpty()) {
			cur=info.Q.poll();
			cur.Parent.Work(cur, info);
		}
	}

	@Override
	public void Work(EInterface from, EInfo info) {
		if (from == null) return;
		if (from == this.Negative) {
			System.out.println("Oh I did it !");
			return;
		}
		if (from == this.Positive) {

		}
	}
}
